package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcGroupOrganize;
import com.visizen.wisdomclass.server.model.WcGroupOrganizeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WcGroupOrganizeMapper {
    @SelectProvider(type=WcGroupOrganizeSqlProvider.class, method="countByExample")
    int countByExample(WcGroupOrganizeExample example);

    @DeleteProvider(type=WcGroupOrganizeSqlProvider.class, method="deleteByExample")
    int deleteByExample(WcGroupOrganizeExample example);

    @Delete({
        "delete from wc_group_organize",
        "where GROUP_ID = #{GROUP_ID,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long GROUP_ID);

    @Insert({
        "insert into wc_group_organize (GROUP_ID, PARENT_ID, ",
        "GROUP_NAME, DESCRIPTION, ",
        "LEVEL)",
        "values (#{GROUP_ID,jdbcType=BIGINT}, #{PARENT_ID,jdbcType=BIGINT}, ",
        "#{GROUP_NAME,jdbcType=VARCHAR}, #{DESCRIPTION,jdbcType=VARCHAR}, ",
        "#{LEVEL,jdbcType=INTEGER})"
    })
    int insert(WcGroupOrganize record);

    @InsertProvider(type=WcGroupOrganizeSqlProvider.class, method="insertSelective")
    int insertSelective(WcGroupOrganize record);

    @SelectProvider(type=WcGroupOrganizeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="GROUP_ID", property="GROUP_ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="PARENT_ID", property="PARENT_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="GROUP_NAME", property="GROUP_NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="DESCRIPTION", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL", property="LEVEL", jdbcType=JdbcType.INTEGER)
    })
    List<WcGroupOrganize> selectByExample(WcGroupOrganizeExample example);

    @Select({
        "select",
        "GROUP_ID, PARENT_ID, GROUP_NAME, DESCRIPTION, LEVEL",
        "from wc_group_organize",
        "where GROUP_ID = #{GROUP_ID,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="GROUP_ID", property="GROUP_ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="PARENT_ID", property="PARENT_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="GROUP_NAME", property="GROUP_NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="DESCRIPTION", property="DESCRIPTION", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL", property="LEVEL", jdbcType=JdbcType.INTEGER)
    })
    WcGroupOrganize selectByPrimaryKey(Long GROUP_ID);

    @UpdateProvider(type=WcGroupOrganizeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcGroupOrganize record, @Param("example") WcGroupOrganizeExample example);

    @UpdateProvider(type=WcGroupOrganizeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") WcGroupOrganize record, @Param("example") WcGroupOrganizeExample example);

    @UpdateProvider(type=WcGroupOrganizeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcGroupOrganize record);

    @Update({
        "update wc_group_organize",
        "set PARENT_ID = #{PARENT_ID,jdbcType=BIGINT},",
          "GROUP_NAME = #{GROUP_NAME,jdbcType=VARCHAR},",
          "DESCRIPTION = #{DESCRIPTION,jdbcType=VARCHAR},",
          "LEVEL = #{LEVEL,jdbcType=INTEGER}",
        "where GROUP_ID = #{GROUP_ID,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WcGroupOrganize record);
}